import {request} from "@/network/request";


export function getCartList(include:boolean=false) {
    return request({
        url: `api/carts${include ? '?include=goods':''}`,
    });
}
export function addShopCart(data:{goods_id:string, num:string}) {
    return request({
        url: "/api/carts",
        method: 'post',
        data,
    });
}

export function changeShopCartCount(cardId:string, data:{num:string}) {
    return request({
        url: `/api/carts/${cardId}`,
        method: "put",
        data,
    });
}

export function deleteShopCart(cardId:string) {
    return request({
        url: `/api/carts/${cardId}`,
        method: "delete",
    });
}

export function changeShopCartChecked( data:{cart_ids:number[]}) {
    return request({
        url: "/api/carts/checked",
        method: "PATCH",
        data,
    });
}


